﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using DevExpress.Web.ASPxScheduler.Internal;
using DevExpress.Web.ASPxEditors;
using DevExpress.XtraScheduler;

namespace DevExpress.Web.ASPxScheduler
{
    public class CustomFieldNames
    {
        public const string rPersonal = "rPersonal"; //个人日程
        public const string rProxy = "rProxy"; //代理人填写
        public const string ProxyId = "ProxyId";    //选择代理人id
        public const string PersonalSch = "PersonalSch";    //私人日程

        public const string rCompleteN = "rCompleteN";
        public const string rCompleteY = "rCompleteY";

        public const string OnLineMes = "OnLineMes";  //在线消息
        public const string NowReport = "NowReport";  //即时通讯
        public const string PhoneMes = "PhoneMes";   //手机短信
        public const string AdvTime = "AdvTime"; //提前时间
        public const string RemindTimeType = "RemindTimeType";  //提醒时间类型

        public const string CycleSet = "CycleSet";  //周期循环
        //按天
        public const string Day = "Day";
        public const string rEveryDay = "rEveryDay";
        public const string tEveryDay = "tEveryDay";
        public const string rEveryWeekDay = "rEveryWeekDay";
        //按周
        public const string Week = "Week";
        public const string tWeekInterval = "tWeekInterval";
        public const string cWeekOne = "cWeekOne";
        public const string cWeekTwo = "cWeekTwo";
        public const string cWeekThree = "cWeekThree";
        public const string cWeekFour = "cWeekFour";
        public const string cWeekFive = "cWeekFive";
        public const string cWeekSix = "cWeekSix";
        public const string cWeekSeven = "cWeekSeven";
        //按月
        public const string Month = "Month";
        public const string rEveryMonth1 = "rEveryMonth1";
        public const string tEveryMonth1 = "tEveryMonth1";
        public const string tMonthDay1 = "tMonthDay1";
        public const string rEveryMonth2 = "rEveryMonth2";
        public const string tEveryMonth2 = "tEveryMonth2";
        public const string dMonthCount = "dMonthCount";
        public const string dMonthWeek = "dMonthWeek";
        public const string rMonthCalender = "rMonthCalender";
        public const string rMonthLunar = "rMonthLunar";
        //按年
        public const string Year = "Year";
        public const string rEveryYear1 = "rEveryYear1";
        public const string dYearMonth1 = "dYearMonth1";
        public const string tYearDay = "tYearDay";
        public const string rEveryYear2 = "rEveryYear2";
        public const string dYearMonth2 = "dYearMonth2";
        public const string dYearCount = "dYearCount";
        public const string dYearWeek = "dYearWeek";
        public const string rYearCalender = "rYearCalender";
        public const string rYearLunar = "rYearLunar";
        //重复范围
        public const string dBeginDate = "dBeginDate";
        public const string rCircle = "rCircle";
        public const string tRepeat = "tRepeat"; //重复次数
        public const string rEndDate = "rEndDate";
        public const string dEndDate = "dEndDate";

    }

    public class MyCustomContainer : AppointmentFormTemplateContainer
    {
        public MyCustomContainer(ASPxScheduler control)
            : base(control)
        { }
        public bool rPersonal
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rPersonal]); }
        }
        public bool rProxy
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rProxy]); }
        }
        public int ProxyId
        {
            get { return Convert.ToInt32(Appointment.CustomFields[CustomFieldNames.ProxyId]); }
        }
        public bool PersonalSch
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.PersonalSch]); }
        }


        public bool rCompleteN
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rCompleteN]); }
        }
        public bool rCompleteY
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rCompleteY]); }
        }

        public bool OnLineMes
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.OnLineMes]); }
        }
        public bool NowReport
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.NowReport]); }
        }
        public bool PhoneMes
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.PhoneMes]); }
        }
        public string AdvTime
        {
            get { return Convert.ToString(Appointment.CustomFields[CustomFieldNames.AdvTime]); }
        }
        public int RemindTimeType
        {
            get { return Convert.ToInt32(Appointment.CustomFields[CustomFieldNames.RemindTimeType]); }
        }

        public bool CycleSet
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.CycleSet]); }
        }

        public bool Day
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.Day]); }
        }
        public bool rEveryDay
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rEveryDay]); }
        }
        public string tEveryDay
        {
            get { return Convert.ToString(Appointment.CustomFields[CustomFieldNames.tEveryDay]); }
        }
        public bool rEveryWeekDay
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rEveryWeekDay]); }
        }

        public bool Week
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.Week]); }
        }
        public string tWeekInterval
        {
            get { return Convert.ToString(Appointment.CustomFields[CustomFieldNames.tWeekInterval]); }
        }
        public bool cWeekOne
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.cWeekOne]); }
        }
        public bool cWeekTwo
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.cWeekTwo]); }
        }
        public bool cWeekThree
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.cWeekThree]); }
        }
        public bool cWeekFour
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.cWeekFour]); }
        }
        public bool cWeekFive
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.cWeekFive]); }
        }
        public bool cWeekSix
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.cWeekSix]); }
        }
        public bool cWeekSeven
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.cWeekSeven]); }
        }

        public bool Month
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.Month]); }
        }
        public bool rEveryMonth1
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rEveryMonth1]); }
        }
        public string tEveryMonth1
        {
            get { return Convert.ToString(Appointment.CustomFields[CustomFieldNames.tEveryMonth1]); }
        }
        public string tMonthDay1
        {
            get { return Convert.ToString(Appointment.CustomFields[CustomFieldNames.tMonthDay1]); }
        }
        public bool rEveryMonth2
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rEveryMonth2]); }
        }
        public string tEveryMonth2
        {
            get { return Convert.ToString(Appointment.CustomFields[CustomFieldNames.tEveryMonth2]); }
        }
        public int dMonthCount
        {
            get { return Convert.ToInt32(Appointment.CustomFields[CustomFieldNames.dMonthCount]); }
        }
        public int dMonthWeek
        {
            get { return Convert.ToInt32(Appointment.CustomFields[CustomFieldNames.dMonthWeek]); }
        }
        public bool rMonthCalender
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rMonthCalender]); }
        }
        public bool rMonthLunar
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rMonthLunar]); }
        }

        public bool Year
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rMonthLunar]); }
        }
        public bool rEveryYear1
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rEveryYear1]); }
        }
        public int dYearMonth1
        {
            get { return Convert.ToInt32(Appointment.CustomFields[CustomFieldNames.dYearMonth1]); }
        }
        public string tYearDay
        {
            get { return Convert.ToString(Appointment.CustomFields[CustomFieldNames.tYearDay]); }
        }
        public bool rEveryYear2
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rEveryYear2]); }
        }
        public int dYearMonth2
        {
            get { return Convert.ToInt32(Appointment.CustomFields[CustomFieldNames.dYearMonth2]); }
        }
        public int dYearCount
        {
            get { return Convert.ToInt32(Appointment.CustomFields[CustomFieldNames.dYearCount]); }
        }
        public int dYearWeek
        {
            get { return Convert.ToInt32(Appointment.CustomFields[CustomFieldNames.dYearWeek]); }
        }
        public bool rYearCalender
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rYearCalender]); }
        }
        public bool rYearLunar
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rYearLunar]); }
        }

        public DateTime dBeginDate
        {
            get { return Convert.ToDateTime(Appointment.CustomFields[CustomFieldNames.dBeginDate]); }
        }
        public bool rCircle
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rCircle]); }
        }
        public string tRepeat
        {
            get { return Convert.ToString(Appointment.CustomFields[CustomFieldNames.tRepeat]); }
        }
        public bool rEndDate
        {
            get { return Convert.ToBoolean(Appointment.CustomFields[CustomFieldNames.rEndDate]); }
        }
        public DateTime dEndDate
        {
            get { return Convert.ToDateTime(Appointment.CustomFields[CustomFieldNames.dEndDate]); }
        }
    }

    public class MyCustomController : AppointmentFormController
    {
        private const string rPersonalFieldName = "rPersonal"; //个人日程
        private const string rProxyFieldName = "rProxy"; //代理人填写
        private const string ProxyIdFieldName = "ProxyId";    //选择代理人id
        private const string PersonalSchFieldName = "PersonalSch";    //私人日程

        private const string rCompleteNField = "rCompleteN";
        private const string rCompleteYField = "rCompleteY";

        private const string OnLineMesFieldName = "OnLineMes";  //在线消息
        private const string NowReportFieldName = "NowReport";  //即时通讯
        private const string PhoneMesFieldName = "PhoneMes";   //手机短信
        private const string AdvTimeFieldName = "AdvTime"; //提前时间
        private const string RemindTimeTypeFieldName = "RemindTimeType";  //提醒时间类型

        private const string CycleSetFieldName = "CycleSet";  //周期循环

        //按天
        private const string DayFieldName = "Day";
        private const string rEveryDayFieldName = "rEveryDay";
        private const string tEveryDayFieldName = "tEveryDay";
        private const string rEveryWeekDayFieldName = "rEveryWeekDay";
        //按周
        private const string WeekFieldName = "Week";
        private const string tWeekIntervalFieldName = "tWeekInterval";
        private const string cWeekOneFieldName = "cWeekOne";
        private const string cWeekTwoFieldName = "cWeekTwo";
        private const string cWeekThreeFieldName = "cWeekThree";
        private const string cWeekFourFieldName = "cWeekFour";
        private const string cWeekFiveFieldName = "cWeekFive";
        private const string cWeekSixFieldName = "cWeekSix";
        private const string cWeekSevenFieldName = "cWeekSeven";
        //按月
        private const string MonthFieldName = "Month";
        private const string rEveryMonth1FieldName = "rEveryMonth1";
        private const string tEveryMonth1FieldName = "tEveryMonth1";
        private const string tMonthDay1FieldName = "tMonthDay1";
        private const string rEveryMonth2FieldName = "rEveryMonth2";
        private const string tEveryMonth2FieldName = "tEveryMonth2";
        private const string dMonthCountFieldName = "dMonthCount";
        private const string dMonthWeekFieldName = "dMonthWeek";
        private const string rMonthCalenderFieldName = "rMonthCalender";
        private const string rMonthLunarFieldName = "rMonthLunar";
        //按年
        private const string YearFieldName = "Year";
        private const string rEveryYear1FieldName = "rEveryYear1";
        private const string dYearMonth1FieldName = "dYearMonth1";
        private const string tYearDayFieldName = "tYearDay";
        private const string rEveryYear2FieldName = "rEveryYear2";
        private const string dYearMonth2FieldName = "dYearMonth2";
        private const string dYearCountFieldName = "dYearCount";
        private const string dYearWeekFieldName = "dYearWeek";
        private const string rYearCalenderFieldName = "rYearCalender";
        private const string rYearLunarFieldName = "rYearLunar";
        //重复范围
        private const string dBeginDateFieldName = "dBeginDate";
        private const string rCircleFieldName = "rCircle";
        private const string tRepeatFieldName = "tRepeat"; //重复次数
        private const string rEndDateFieldName = "rEndDate";
        private const string dEndDateFieldName = "dEndDate";

        public MyCustomController(ASPxScheduler control, Appointment apt)
            : base(control, apt)
        { }
        #region 属性赋值取值

        public bool rPersonal
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rPersonalFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rPersonalFieldName] = value; }
        }
        public bool rProxy
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rProxyFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rProxyFieldName] = value; }
        }
        public int ProxyId
        {
            get { return Convert.ToInt32(EditedAppointmentCopy.CustomFields[ProxyIdFieldName]); }
            set { EditedAppointmentCopy.CustomFields[ProxyIdFieldName] = value; }
        }
        public bool PersonalSch
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[PersonalSchFieldName]); }
            set { EditedAppointmentCopy.CustomFields[PersonalSchFieldName] = value; }
        }

        public bool rCompleteN
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rCompleteNField]); }
            set { EditedAppointmentCopy.CustomFields[rCompleteNField] = value; }
        }
        public bool rCompleteY
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rCompleteYField]); }
            set { EditedAppointmentCopy.CustomFields[rCompleteYField] = value; }
        }

        public bool OnLineMes
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[OnLineMesFieldName]); }
            set { EditedAppointmentCopy.CustomFields[OnLineMesFieldName] = value; }
        }
        public bool NowReport
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[NowReportFieldName]); }
            set { EditedAppointmentCopy.CustomFields[NowReportFieldName] = value; }
        }
        public bool PhoneMes
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[PhoneMesFieldName]); }
            set { EditedAppointmentCopy.CustomFields[PhoneMesFieldName] = value; }
        }
        public string AdvTime
        {
            get { return (string)EditedAppointmentCopy.CustomFields[AdvTimeFieldName]; }
            set { EditedAppointmentCopy.CustomFields[AdvTimeFieldName] = value; }
        }
        public int RemindTimeType
        {
            get { return Convert.ToInt32(EditedAppointmentCopy.CustomFields[RemindTimeTypeFieldName]); }
            set { EditedAppointmentCopy.CustomFields[RemindTimeTypeFieldName] = value; }
        }

        public bool CycleSet
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[CycleSetFieldName]); }
            set { EditedAppointmentCopy.CustomFields[CycleSetFieldName] = value; }
        }

        public bool Day
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[DayFieldName]); }
            set { EditedAppointmentCopy.CustomFields[DayFieldName] = value; }
        }
        public bool rEveryDay
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rEveryDayFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rEveryDayFieldName] = value; }
        }
        public string tEveryDay
        {
            get { return (string)EditedAppointmentCopy.CustomFields[tEveryDayFieldName]; }
            set { EditedAppointmentCopy.CustomFields[tEveryDayFieldName] = value; }
        }
        public bool rEveryWeekDay
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rEveryWeekDayFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rEveryWeekDayFieldName] = value; }
        }

        public bool Week
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[WeekFieldName]); }
            set { EditedAppointmentCopy.CustomFields[WeekFieldName] = value; }
        }
        public string tWeekInterval
        {
            get { return (string)EditedAppointmentCopy.CustomFields[tWeekIntervalFieldName]; }
            set { EditedAppointmentCopy.CustomFields[tWeekIntervalFieldName] = value; }
        }
        public bool cWeekOne
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[cWeekOneFieldName]); }
            set { EditedAppointmentCopy.CustomFields[cWeekOneFieldName] = value; }
        }
        public bool cWeekTwo
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[cWeekTwoFieldName]); }
            set { EditedAppointmentCopy.CustomFields[cWeekTwoFieldName] = value; }
        }
        public bool cWeekThree
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[cWeekThreeFieldName]); }
            set { EditedAppointmentCopy.CustomFields[cWeekThreeFieldName] = value; }
        }
        public bool cWeekFour
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[cWeekFourFieldName]); }
            set { EditedAppointmentCopy.CustomFields[cWeekFourFieldName] = value; }
        }
        public bool cWeekFive
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[cWeekFiveFieldName]); }
            set { EditedAppointmentCopy.CustomFields[cWeekFiveFieldName] = value; }
        }
        public bool cWeekSix
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[cWeekSixFieldName]); }
            set { EditedAppointmentCopy.CustomFields[cWeekSixFieldName] = value; }
        }
        public bool cWeekSeven
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[cWeekSevenFieldName]); }
            set { EditedAppointmentCopy.CustomFields[cWeekSevenFieldName] = value; }
        }

        public bool Month
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[MonthFieldName]); }
            set { EditedAppointmentCopy.CustomFields[MonthFieldName] = value; }
        }
        public bool rEveryMonth1
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rEveryMonth1FieldName]); }
            set { EditedAppointmentCopy.CustomFields[rEveryMonth1FieldName] = value; }
        }
        public string tEveryMonth1
        {
            get { return (string)EditedAppointmentCopy.CustomFields[tEveryMonth1FieldName]; }
            set { EditedAppointmentCopy.CustomFields[tEveryMonth1FieldName] = value; }
        }
        public string tMonthDay1
        {
            get { return (string)EditedAppointmentCopy.CustomFields[tMonthDay1FieldName]; }
            set { EditedAppointmentCopy.CustomFields[tMonthDay1FieldName] = value; }
        }
        public bool rEveryMonth2
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rEveryMonth2FieldName]); }
            set { EditedAppointmentCopy.CustomFields[rEveryMonth2FieldName] = value; }
        }
        public string tEveryMonth2
        {
            get { return (string)EditedAppointmentCopy.CustomFields[tEveryMonth2FieldName]; }
            set { EditedAppointmentCopy.CustomFields[tEveryMonth2FieldName] = value; }
        }
        public int dMonthCount
        {
            get { return Convert.ToInt32(EditedAppointmentCopy.CustomFields[dMonthCountFieldName]); }
            set { EditedAppointmentCopy.CustomFields[dMonthCountFieldName] = value; }
        }
        public int dMonthWeek
        {
            get { return Convert.ToInt32(EditedAppointmentCopy.CustomFields[dMonthWeekFieldName]); }
            set { EditedAppointmentCopy.CustomFields[dMonthWeekFieldName] = value; }
        }
        public bool rMonthCalender
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rMonthCalenderFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rMonthCalenderFieldName] = value; }
        }
        public bool rMonthLunar
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rMonthLunarFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rMonthLunarFieldName] = value; }
        }

        public bool Year
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[YearFieldName]); }
            set { EditedAppointmentCopy.CustomFields[YearFieldName] = value; }
        }
        public bool rEveryYear1
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rEveryYear1FieldName]); }
            set { EditedAppointmentCopy.CustomFields[rEveryYear1FieldName] = value; }
        }
        public int dYearMonth1
        {
            get { return Convert.ToInt32(EditedAppointmentCopy.CustomFields[dYearMonth1FieldName]); }
            set { EditedAppointmentCopy.CustomFields[dYearMonth1FieldName] = value; }
        }
        public string tYearDay
        {
            get { return (string)EditedAppointmentCopy.CustomFields[tYearDayFieldName]; }
            set { EditedAppointmentCopy.CustomFields[tYearDayFieldName] = value; }
        }
        public bool rEveryYear2
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rEveryYear2FieldName]); }
            set { EditedAppointmentCopy.CustomFields[rEveryYear2FieldName] = value; }
        }
        public int dYearMonth2
        {
            get { return Convert.ToInt32(EditedAppointmentCopy.CustomFields[dYearMonth2FieldName]); }
            set { EditedAppointmentCopy.CustomFields[dYearMonth2FieldName] = value; }
        }
        public int dYearCount
        {
            get { return Convert.ToInt32(EditedAppointmentCopy.CustomFields[dYearCountFieldName]); }
            set { EditedAppointmentCopy.CustomFields[dYearCountFieldName] = value; }
        }
        public int dYearWeek
        {
            get { return Convert.ToInt32(EditedAppointmentCopy.CustomFields[dYearWeekFieldName]); }
            set { EditedAppointmentCopy.CustomFields[dYearWeekFieldName] = value; }
        }
        public bool rYearCalender
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rYearCalenderFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rYearCalenderFieldName] = value; }
        }
        public bool rYearLunar
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rYearLunarFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rYearLunarFieldName] = value; }
        }
        public DateTime dBeginDate
        {
            get { return Convert.ToDateTime(EditedAppointmentCopy.CustomFields[dBeginDateFieldName]); }
            set { EditedAppointmentCopy.CustomFields[dBeginDateFieldName] = value; }
        }
        public bool rCircle
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rCircleFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rCircleFieldName] = value; }
        }
        public string tRepeat
        {
            get { return (string)EditedAppointmentCopy.CustomFields[tRepeatFieldName]; }
            set { EditedAppointmentCopy.CustomFields[tRepeatFieldName] = value; }
        }
        public bool rEndDate
        {
            get { return Convert.ToBoolean(EditedAppointmentCopy.CustomFields[rEndDateFieldName]); }
            set { EditedAppointmentCopy.CustomFields[rEndDateFieldName] = value; }
        }
        public DateTime dEndDate
        {
            get { return Convert.ToDateTime(EditedAppointmentCopy.CustomFields[dEndDateFieldName]); }
            set { EditedAppointmentCopy.CustomFields[dEndDateFieldName] = value; }
        }

        #endregion

        bool SourceRpersonal { get { return Convert.ToBoolean(SourceAppointment.CustomFields[rPersonalFieldName]); } set { SourceAppointment.CustomFields[rPersonalFieldName] = value; } }
        bool SourceRproxy { get { return (bool)SourceAppointment.CustomFields[rProxyFieldName]; } set { SourceAppointment.CustomFields[rProxyFieldName] = value; } }
        int SourceProxyId { get { return (int)SourceAppointment.CustomFields[ProxyIdFieldName]; } set { SourceAppointment.CustomFields[ProxyIdFieldName] = value; } }
        bool SourcePersonalSch { get { return (bool)SourceAppointment.CustomFields[PersonalSchFieldName]; } set { SourceAppointment.CustomFields[PersonalSchFieldName] = value; } }

        bool SourceRcompleteN { get { return (bool)SourceAppointment.CustomFields[rCompleteNField]; } set { SourceAppointment.CustomFields[rCompleteNField] = value; } }
        bool SourceRcompleteY { get { return (bool)SourceAppointment.CustomFields[rCompleteYField]; } set { SourceAppointment.CustomFields[rCompleteYField] = value; } }

        bool SourceOnLineMes { get { return (bool)SourceAppointment.CustomFields[OnLineMesFieldName]; } set { SourceAppointment.CustomFields[OnLineMesFieldName] = value; } }
        bool SourceNowReport { get { return (bool)SourceAppointment.CustomFields[NowReportFieldName]; } set { SourceAppointment.CustomFields[NowReportFieldName] = value; } }
        bool SourcePhoneMes { get { return (bool)SourceAppointment.CustomFields[PhoneMesFieldName]; } set { SourceAppointment.CustomFields[PhoneMesFieldName] = value; } }
        string SourceAdvTime { get { return (string)SourceAppointment.CustomFields[AdvTimeFieldName]; } set { SourceAppointment.CustomFields[AdvTimeFieldName] = value; } }
        int SourceRemindTimeType { get { return (int)SourceAppointment.CustomFields[RemindTimeTypeFieldName]; } set { SourceAppointment.CustomFields[RemindTimeTypeFieldName] = value; } }

        bool SourceCycleSet { get { return (bool)SourceAppointment.CustomFields[CycleSetFieldName]; } set { SourceAppointment.CustomFields[CycleSetFieldName] = value; } }

        bool SourceDay { get { return (bool)SourceAppointment.CustomFields[DayFieldName]; } set { SourceAppointment.CustomFields[DayFieldName] = value; } }
        bool SourceReveryDay { get { return (bool)SourceAppointment.CustomFields[rEveryDayFieldName]; } set { SourceAppointment.CustomFields[rEveryDayFieldName] = value; } }
        string SourceTeveryDay { get { return (string)SourceAppointment.CustomFields[tEveryDayFieldName]; } set { SourceAppointment.CustomFields[tEveryDayFieldName] = value; } }
        bool SourceReveryWeekDay { get { return (bool)SourceAppointment.CustomFields[rEveryWeekDayFieldName]; } set { SourceAppointment.CustomFields[rEveryWeekDayFieldName] = value; } }

        bool SourceWeek { get { return (bool)SourceAppointment.CustomFields[WeekFieldName]; } set { SourceAppointment.CustomFields[WeekFieldName] = value; } }
        string SourceTweekInterval { get { return (string)SourceAppointment.CustomFields[tWeekIntervalFieldName]; } set { SourceAppointment.CustomFields[tWeekIntervalFieldName] = value; } }
        bool SourceCweekOne { get { return (bool)SourceAppointment.CustomFields[cWeekOneFieldName]; } set { SourceAppointment.CustomFields[cWeekOneFieldName] = value; } }
        bool SourceCweekTwo { get { return (bool)SourceAppointment.CustomFields[cWeekTwoFieldName]; } set { SourceAppointment.CustomFields[cWeekTwoFieldName] = value; } }
        bool SourceCweekThree { get { return (bool)SourceAppointment.CustomFields[cWeekThreeFieldName]; } set { SourceAppointment.CustomFields[cWeekThreeFieldName] = value; } }
        bool SourceCweekFour { get { return (bool)SourceAppointment.CustomFields[cWeekFourFieldName]; } set { SourceAppointment.CustomFields[cWeekFourFieldName] = value; } }
        bool SourceCweekFive { get { return (bool)SourceAppointment.CustomFields[cWeekFiveFieldName]; } set { SourceAppointment.CustomFields[cWeekFiveFieldName] = value; } }
        bool SourceCweekSix { get { return (bool)SourceAppointment.CustomFields[cWeekSixFieldName]; } set { SourceAppointment.CustomFields[cWeekSixFieldName] = value; } }
        bool SourceCweekSeven { get { return (bool)SourceAppointment.CustomFields[cWeekSevenFieldName]; } set { SourceAppointment.CustomFields[cWeekSevenFieldName] = value; } }

        bool SourceMonth { get { return (bool)SourceAppointment.CustomFields[MonthFieldName]; } set { SourceAppointment.CustomFields[MonthFieldName] = value; } }
        bool SourceReveryMonth1 { get { return (bool)SourceAppointment.CustomFields[rEveryMonth1FieldName]; } set { SourceAppointment.CustomFields[rEveryMonth1FieldName] = value; } }
        string SourceTeveryMonth1 { get { return (string)SourceAppointment.CustomFields[tEveryMonth1FieldName]; } set { SourceAppointment.CustomFields[tEveryMonth1FieldName] = value; } }
        string SourceTmonthDay1 { get { return (string)SourceAppointment.CustomFields[tMonthDay1FieldName]; } set { SourceAppointment.CustomFields[tMonthDay1FieldName] = value; } }
        bool SourceReveryMonth2 { get { return (bool)SourceAppointment.CustomFields[rEveryMonth2FieldName]; } set { SourceAppointment.CustomFields[rEveryMonth2FieldName] = value; } }
        string SourceTeveryMonth2 { get { return (string)SourceAppointment.CustomFields[tEveryMonth2]; } set { SourceAppointment.CustomFields[tEveryMonth2FieldName] = value; } }
        int SourceDmonthCount { get { return (int)SourceAppointment.CustomFields[dMonthCountFieldName]; } set { SourceAppointment.CustomFields[dMonthCountFieldName] = value; } }
        int SourceDmonthWeek { get { return (int)SourceAppointment.CustomFields[dMonthWeekFieldName]; } set { SourceAppointment.CustomFields[dMonthWeekFieldName] = value; } }
        bool SourceRmonthCalender { get { return (bool)SourceAppointment.CustomFields[rMonthCalenderFieldName]; } set { SourceAppointment.CustomFields[rMonthCalenderFieldName] = value; } }
        bool SourceRmonthLunar { get { return (bool)SourceAppointment.CustomFields[rMonthLunarFieldName]; } set { SourceAppointment.CustomFields[rMonthLunarFieldName] = value; } }

        bool SourceYear { get { return (bool)SourceAppointment.CustomFields[YearFieldName]; } set { SourceAppointment.CustomFields[YearFieldName] = value; } }
        bool SourceReveryYear1 { get { return (bool)SourceAppointment.CustomFields[rEveryYear1FieldName]; } set { SourceAppointment.CustomFields[rEveryYear1FieldName] = value; } }
        int SourceDyearMonth1 { get { return (int)SourceAppointment.CustomFields[dYearMonth1FieldName]; } set { SourceAppointment.CustomFields[dYearMonth1FieldName] = value; } }
        string SourceTyearDay { get { return (string)SourceAppointment.CustomFields[tYearDayFieldName]; } set { SourceAppointment.CustomFields[tYearDayFieldName] = value; } }
        bool SourceReveryYear2 { get { return (bool)SourceAppointment.CustomFields[rEveryYear2FieldName]; } set { SourceAppointment.CustomFields[rEveryYear2FieldName] = value; } }
        int SourceDyearMonth2 { get { return (int)SourceAppointment.CustomFields[dYearMonth2]; } set { SourceAppointment.CustomFields[dYearMonth2FieldName] = value; } }
        int SourceDyearCount { get { return (int)SourceAppointment.CustomFields[dYearCountFieldName]; } set { SourceAppointment.CustomFields[dYearCountFieldName] = value; } }
        int SourceDyearWeek { get { return (int)SourceAppointment.CustomFields[dYearWeekFieldName]; } set { SourceAppointment.CustomFields[dYearWeekFieldName] = value; } }
        bool SourceRyearCalender { get { return (bool)SourceAppointment.CustomFields[rYearCalenderFieldName]; } set { SourceAppointment.CustomFields[rYearCalenderFieldName] = value; } }
        bool SourceRyearLunar { get { return (bool)SourceAppointment.CustomFields[rYearLunarFieldName]; } set { SourceAppointment.CustomFields[rYearLunarFieldName] = value; } }

        DateTime SourceDbeginDate { get { return (DateTime)SourceAppointment.CustomFields[dBeginDateFieldName]; } set { SourceAppointment.CustomFields[dBeginDateFieldName] = value; } }
        bool SourceRcircle { get { return (bool)SourceAppointment.CustomFields[rCircleFieldName]; } set { SourceAppointment.CustomFields[rCircleFieldName] = value; } }
        string SourceTrepeat { get { return (string)SourceAppointment.CustomFields[tRepeatFieldName]; } set { SourceAppointment.CustomFields[tRepeatFieldName] = value; } }
        bool SourceRendDate { get { return (bool)SourceAppointment.CustomFields[rEndDateFieldName]; } set { SourceAppointment.CustomFields[rEndDateFieldName] = value; } }
        DateTime SourceDendDate { get { return (DateTime)SourceAppointment.CustomFields[dEndDateFieldName]; } set { SourceAppointment.CustomFields[dEndDateFieldName] = value; } }


        public override bool IsAppointmentChanged()
        {
            if (base.IsAppointmentChanged())
                return true;
            return SourceRpersonal != rPersonal || SourceRproxy != rProxy || SourceProxyId != ProxyId || SourcePersonalSch != PersonalSch || SourceCycleSet != CycleSet ||
                   SourceOnLineMes != OnLineMes || SourceNowReport != NowReport || SourcePhoneMes != PhoneMes || SourceAdvTime != AdvTime || SourceRemindTimeType != RemindTimeType ||
                   SourceDay != Day || SourceReveryDay != rEveryDay || SourceTeveryDay != tEveryDay || SourceReveryWeekDay != rEveryWeekDay || SourceWeek != Week ||
                   SourceTweekInterval != tWeekInterval || SourceCweekOne != cWeekOne || SourceCweekTwo != cWeekTwo || SourceCweekThree != cWeekThree || SourceCweekFour != cWeekFour ||
                   SourceCweekFive != cWeekFive || SourceCweekSix != cWeekSix || SourceCweekSeven != cWeekSeven || SourceMonth != Month || SourceReveryMonth1 != rEveryMonth1 ||
                   SourceTeveryMonth1 != tEveryMonth1 || SourceTmonthDay1 != tMonthDay1 || SourceReveryMonth2 != rEveryMonth2 || SourceTeveryMonth2 != tEveryMonth2 || SourceDmonthCount != dMonthCount || SourceDmonthWeek != dMonthWeek ||
                   SourceRmonthCalender != rMonthCalender || SourceRmonthLunar != rMonthLunar || SourceYear != Year || SourceReveryYear1 != rEveryYear1 || SourceDyearMonth1 != dYearMonth1 ||
                   SourceTyearDay != tYearDay || SourceReveryYear2 != rEveryYear2 || SourceDyearMonth2 != dYearMonth2 || SourceDyearCount != dYearCount || SourceDyearWeek != dYearWeek || SourceRyearCalender != rYearCalender ||
                   SourceRyearLunar != rYearLunar || SourceDbeginDate != dBeginDate || SourceRcircle != rCircle || SourceTrepeat != tRepeat || SourceRendDate != rEndDate ||
                   SourceDendDate != dEndDate || SourceRcompleteN != rCompleteN || SourceRcompleteY != rCompleteY;
        }

        protected override void ApplyCustomFieldsValues()
        {
            SourceRpersonal = rPersonal;
            SourceRproxy = rProxy;
            SourceProxyId = ProxyId;
            SourcePersonalSch = PersonalSch;
            SourceCycleSet = CycleSet;
            SourceOnLineMes = OnLineMes;
            SourceNowReport = NowReport;
            SourcePhoneMes = PhoneMes;
            SourceAdvTime = AdvTime;
            SourceRemindTimeType = RemindTimeType;

            SourceDay = Day;
            SourceReveryDay = rEveryDay;
            SourceTeveryDay = tEveryDay;
            SourceReveryWeekDay = rEveryWeekDay;

            SourceWeek = Week;
            SourceTweekInterval = tWeekInterval;
            SourceCweekOne = cWeekOne;
            SourceCweekTwo = cWeekTwo;
            SourceCweekThree = cWeekThree;
            SourceCweekFour = cWeekFour;
            SourceCweekFive = cWeekFive;
            SourceCweekSix = cWeekSix;
            SourceCweekSeven = cWeekSeven;

            SourceMonth = Month;
            SourceReveryMonth1 = rEveryMonth1;
            SourceTeveryMonth1 = tEveryMonth1;
            SourceTmonthDay1 = tMonthDay1;
            SourceReveryMonth2 = rEveryMonth2;
            SourceTeveryMonth2 = tEveryMonth2;
            SourceDmonthCount = dMonthCount;
            SourceDmonthWeek = dMonthWeek;
            SourceRmonthCalender = rMonthCalender;
            SourceRmonthLunar = rMonthLunar;

            SourceYear = Year;
            SourceReveryYear1 = rEveryYear1;
            SourceDyearMonth1 = dYearMonth1;
            SourceTyearDay = tYearDay;
            SourceReveryYear2 = rEveryYear2;
            SourceDyearMonth2 = dYearMonth2;
            SourceDyearCount = dYearCount;
            SourceDyearWeek = dYearWeek;
            SourceRyearCalender = rYearCalender;
            SourceRyearLunar = rYearLunar;
            SourceDbeginDate = dBeginDate;
            SourceRcircle = rCircle;
            SourceTrepeat = tRepeat;
            SourceRendDate = rEndDate;
            SourceDendDate = dEndDate;

            SourceRcompleteN = rCompleteN;
            SourceRcompleteY = rCompleteY;
        }
    }

    public class MyCustomCallBackCommand : AppointmentFormSaveCallbackCommand
    {
        public MyCustomCallBackCommand(ASPxScheduler control)
            : base(control)
        { }
        protected internal new MyCustomController Controller
        { get { return (MyCustomController)base.Controller; } }


        protected override void AssignControllerValues()
        {
            ASPxTextBox tbSubject = (ASPxTextBox)FindControlByID("tbSubject");
            ASPxTextBox tbLocation = (ASPxTextBox)FindControlByID("tbLocation");
            ASPxTextBox tbPrice = (ASPxTextBox)FindControlByID("tbPrice");
            ASPxDateEdit edtStartDate = (ASPxDateEdit)FindControlByID("edtStartDate");
            ASPxDateEdit edtEndDate = (ASPxDateEdit)FindControlByID("edtEndDate");
            ASPxMemo memDescription = (ASPxMemo)FindControlByID("tbDescription");
            ASPxComboBox edtResource = (ASPxComboBox)FindControlByID("edtResource");

            #region custom fileds

            ASPxRadioButton radPersonal = (ASPxRadioButton)FindControlByID("radPersonal"); //个人日程
            ASPxRadioButton radProxy = (ASPxRadioButton)FindControlByID("radProxy"); //代理人填写
            ASPxComboBox ddlProxyPerson = (ASPxComboBox)FindControlByID("ddlProxyPerson");  //选择被代理人
            ASPxCheckBox cbkPersonalSch = (ASPxCheckBox)FindControlByID("chkPersonalSch");     //私人日程

            ASPxRadioButton radCompleteN = (ASPxRadioButton)FindControlByID("radCompleteN");
            ASPxRadioButton radCompleteY = (ASPxRadioButton)FindControlByID("radCompleteY");

            /* 提醒方式 */
            ASPxCheckBox cbkOnLine = (ASPxCheckBox)FindControlByID("cbkOnLine");    //在线消息
            ASPxCheckBox cbkNow = (ASPxCheckBox)FindControlByID("cbkNow");          //即时通讯
            ASPxCheckBox cbkPhone = (ASPxCheckBox)FindControlByID("cbkPhone");      //手机短信

            ASPxTextBox tbAdvTime = (ASPxTextBox)FindControlByID("tbAdvTime");      //提前时间
            ASPxComboBox ddlRemindTimeType = (ASPxComboBox)FindControlByID("ddlRemindTimeType");  //提醒时间类型

            #region 定期模式

            ASPxCheckBox cbkCircle = (ASPxCheckBox)FindControlByID("cbkCircle"); // 周期循环
            /* 周期重复 */

            /* 按天 */
            ASPxRadioButton radDay = (ASPxRadioButton)FindControlByID("radDay"); //按天
            ASPxRadioButton radEveryDay = (ASPxRadioButton)FindControlByID("radEveryDay");  //每几天单选
            ASPxTextBox tbEveryDay = (ASPxTextBox)FindControlByID("tbEveryDay");   //每几天 文本框
            ASPxRadioButton radEveryWeekDay = (ASPxRadioButton)FindControlByID("radEveryWeekDay");  //每几个工作日

            /* 按周 */
            ASPxRadioButton radWeek = (ASPxRadioButton)FindControlByID("radWeek");  //按周
            ASPxTextBox tbWeekInterval = (ASPxTextBox)FindControlByID("tbWeekInterval"); //重复时间间隔
            ASPxCheckBox cbkWeekOne = (ASPxCheckBox)FindControlByID("cbkWeekOne");  //星期一
            ASPxCheckBox cbkWeekTwo = (ASPxCheckBox)FindControlByID("cbkWeekTwo");  //星期二
            ASPxCheckBox cbkWeekThree = (ASPxCheckBox)FindControlByID("cbkWeekThree");  //星期三
            ASPxCheckBox cbkWeekFour = (ASPxCheckBox)FindControlByID("cbkWeekFour");  //星期四
            ASPxCheckBox cbkWeekFive = (ASPxCheckBox)FindControlByID("cbkWeekFive");  //星期五
            ASPxCheckBox cbkWeekSix = (ASPxCheckBox)FindControlByID("cbkWeekSix");  //星期六
            ASPxCheckBox cbkWeekSeven = (ASPxCheckBox)FindControlByID("cbkWeekSeven");  //星期日

            /* 按月 */
            ASPxRadioButton radMonth = (ASPxRadioButton)FindControlByID("radMonth");  //按月
            ASPxRadioButton radEveryMonth1 = (ASPxRadioButton)FindControlByID("radEveryMonth1"); //每个月1
            ASPxTextBox tbEveryMonth1 = (ASPxTextBox)FindControlByID("tbEveryMonth1");  //每几个月
            ASPxTextBox tbMonthDay1 = (ASPxTextBox)FindControlByID("tbMonthDay1");  //每几个月的第几天

            ASPxRadioButton radEveryMonth2 = (ASPxRadioButton)FindControlByID("radEveryMonth2"); //每个月2
            ASPxTextBox tbEveryMonth2 = (ASPxTextBox)FindControlByID("tbEveryMonth2");  //每几个月
            ASPxComboBox ddlMonthCount = (ASPxComboBox)FindControlByID("ddlMonthCount"); //第几个星期
            ASPxComboBox ddlMonthWeek = (ASPxComboBox)FindControlByID("ddlMonthWeek"); //星期几

            ASPxRadioButton radMonthCalender = (ASPxRadioButton)FindControlByID("radMonthCalender"); //公历
            ASPxRadioButton radMonthLunar = (ASPxRadioButton)FindControlByID("radMonthLunar"); //农历

            /* 按年 */
            ASPxRadioButton radYear = (ASPxRadioButton)FindControlByID("radYear");  //按年
            ASPxRadioButton radEveryYear1 = (ASPxRadioButton)FindControlByID("radEveryYear1"); // 每年1
            ASPxComboBox ddlYearMonth1 = (ASPxComboBox)FindControlByID("ddlYearMonth1");  //第几个月
            ASPxTextBox tbYearDay = (ASPxTextBox)FindControlByID("tbYearDay"); //第几天

            ASPxRadioButton radEveryYear2 = (ASPxRadioButton)FindControlByID("radEveryYear2"); //每年2
            ASPxComboBox ddlYearMonth2 = (ASPxComboBox)FindControlByID("ddlYearMonth2");  //第几个月
            ASPxComboBox ddlYearCount = (ASPxComboBox)FindControlByID("ddlYearCount");  //第几个
            ASPxComboBox ddlYearWeek = (ASPxComboBox)FindControlByID("ddlYearWeek"); //星期几

            ASPxRadioButton radYearCalender = (ASPxRadioButton)FindControlByID("radYearCalender"); //公历
            ASPxRadioButton radYearLunar = (ASPxRadioButton)FindControlByID("radYearLunar"); //农历

            #endregion

            #region 重复范围

            ASPxDateEdit ddlBeginDate = (ASPxDateEdit)FindControlByID("ddlBeginDate"); //开始
            ASPxRadioButton radCircle = (ASPxRadioButton)FindControlByID("radCircle"); //重复
            ASPxTextBox tbRepeat = (ASPxTextBox)FindControlByID("tbRepeat"); //重复次数
            ASPxRadioButton radEndDate = (ASPxRadioButton)FindControlByID("radEndDate"); //结束日期
            ASPxDateEdit ddlEndDate = (ASPxDateEdit)FindControlByID("ddlEndDate"); //结束日期

            #endregion

            #endregion

            Controller.Subject = tbSubject.Text;
            Controller.Location = tbLocation.Text;
            Controller.Description = memDescription.Text;
            Controller.Start = edtStartDate.Date;
            Controller.End = edtEndDate.Date;
            Controller.ResourceId = (edtResource.Value == null) ? "1" : edtResource.Value.ToString();     

            // custom fields 
            Controller.rPersonal = radPersonal.Checked;
            Controller.rProxy = radProxy.Checked;
            Controller.ProxyId = (ddlProxyPerson.Value == null) ? 1 : int.Parse(ddlProxyPerson.Value.ToString());
            Controller.PersonalSch = cbkPersonalSch.Checked;

            Controller.rCompleteN = radCompleteN.Checked;
            Controller.rCompleteY = radCompleteY.Checked;

            Controller.OnLineMes = cbkOnLine.Checked;
            Controller.NowReport = cbkNow.Checked;
            Controller.PhoneMes = cbkPhone.Checked;
            Controller.AdvTime = tbAdvTime.Text;
            Controller.RemindTimeType = (ddlRemindTimeType.Value == null) ? 1 : int.Parse(ddlRemindTimeType.Value.ToString());

            Controller.CycleSet = cbkCircle.Checked;

            Controller.Day = radDay.Checked;
            Controller.rEveryDay = radEveryDay.Checked;
            Controller.tEveryDay = tbEveryDay.Text;
            Controller.rEveryWeekDay = radEveryWeekDay.Checked;

            Controller.Week = radWeek.Checked;
            Controller.tWeekInterval = tbWeekInterval.Text;
            Controller.cWeekOne = cbkWeekOne.Checked;
            Controller.cWeekTwo = cbkWeekTwo.Checked;
            Controller.cWeekThree = cbkWeekThree.Checked;
            Controller.cWeekFour = cbkWeekFour.Checked;
            Controller.cWeekFive = cbkWeekFive.Checked;
            Controller.cWeekSix = cbkWeekSix.Checked;
            Controller.cWeekSeven = cbkWeekSeven.Checked;

            Controller.Month = radMonth.Checked;
            Controller.rEveryMonth1 = radEveryMonth1.Checked;
            Controller.tEveryMonth1 = tbEveryMonth1.Text;
            Controller.tMonthDay1 = tbMonthDay1.Text;
            Controller.rEveryMonth2 = radEveryMonth2.Checked;
            Controller.tEveryMonth2 = tbEveryMonth2.Text;
            Controller.dMonthCount = (ddlMonthCount.Value == null) ? 1 : int.Parse(ddlMonthCount.Value.ToString());
            Controller.dMonthWeek = (ddlMonthWeek.Value == null) ? 1 : int.Parse(ddlMonthWeek.Value.ToString());
            Controller.rMonthCalender = radMonthCalender.Checked;
            Controller.rMonthLunar = radMonthLunar.Checked;

            Controller.Year = radYear.Checked;
            Controller.rEveryYear1 = radEveryYear1.Checked;
            Controller.dYearMonth1 = (ddlYearMonth1.Value == null) ? 2 : int.Parse(ddlYearMonth1.Value.ToString());
            Controller.tYearDay = tbYearDay.Text;
            Controller.rEveryYear2 = radEveryYear2.Checked;
            Controller.dYearMonth2 = (ddlYearMonth1.Value == null) ? 1 : int.Parse(ddlYearMonth1.Value.ToString());
            Controller.dYearCount = (ddlYearCount.Value == null) ? 1 : int.Parse(ddlYearCount.Value.ToString());
            Controller.dYearWeek = (ddlYearWeek.Value == null) ? 1 : int.Parse(ddlYearWeek.Value.ToString());
            Controller.rYearCalender = radYearCalender.Checked;
            Controller.rYearLunar = radYearLunar.Checked;

            Controller.dBeginDate = (ddlBeginDate.Value != null) ? Convert.ToDateTime(ddlBeginDate.Value.ToString()) : Convert.ToDateTime("2008-08-08");
            Controller.rCircle = radCircle.Checked;
            Controller.tRepeat = tbRepeat.Text;
            Controller.rEndDate = radEndDate.Checked;
            Controller.dEndDate = (ddlEndDate.Value != null) ? Convert.ToDateTime(ddlEndDate.Value.ToString()) : Convert.ToDateTime("2008-08-08");

            DateTime clientStart = FromClientTime(Controller.Start);
            AssignControllerRecurrenceValues(clientStart);
        }


        protected override AppointmentFormController CreateAppointmentFormController(Appointment apt)
        {
            return new MyCustomController(Control, apt);
        }
    }
}
